<!-- userUpdate.php 用于将修改后的用户信息录入数据库。 -->
<?php
  require_once('inc_admin.php');
  //连接数据库 
  connect();
  //使用$_POST数组获取表单中输入的数据
  $id = $_POST['id'];


  if(!empty($_FILES["xjn_pic"]["name"])){
  	$xjn_pic = uploadfile('xjn_pic',UserPhotoPath,array('png','jpg','gif'));
  }
  else{
  	$xjn_pic='';
  }

  $data = array(

		'xjn_title' => trim($_POST['xjn_title']),  
    'xjn_place' => $_POST['xjn_place'],
    'xjn_intro' => $_POST['xjn_intro'],
    'xjn_adddate' => $_POST['xjn_adddate'],
    'xjn_hint' => $_POST['xjn_adddate'],
    'xjn_pic'=>$xjn_pic
  	);

  $result = update('flower',$data,'xjn_id='.$id);
  
  if(!$result){
		echo "更新失败！<br/>";
		echo "<a href='flowerlist.php'>返回</a>";	  
  }else{		
		redirect('flowerlist.php', '更新成功！');
  }	   

   /* $sql = "update users set uname='{$uname}', birthdate='{$birthdate}', gender={$gender}, hobby='{$hobby}', degree={$degree},intro='{$intro}', pic='{$newname}' where uid={$id}";	
  $result = mysql_query($sql) or die("sql={$sql}, 更新失败！<br/>".mysql_error());*/
  //判断是否更新成功
 ?>